home *** CD-ROM | disk | FTP | other *** search
/ This Disc Bytes! / Power Computing - The Disc 2 - This Disc Bytes.ISO / mac / CodeWarrior 7 Lite for 68K / MacOS Support / Headers / Universal Headers / DeskBus.h < prev    next >
Text File  |  1995-07-06  |  8KB  |  275 lines

  1. /*
  2.      File:        DeskBus.h
  3.  
  4.      Contains:    Apple Desktop Bus (ADB) Interfaces.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Package:    Universal Interfaces 2.1 in “MPW Latest” on ETO #18
  8.  
  9.      Copyright:    © 1984-1995 by Apple Computer, Inc.
  10.                  All rights reserved.
  11.  
  12.      Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13.                  stack.  Include the file and version information (from above)
  14.                  in the problem description and send to:
  15.                      Internet:    apple.bugs@applelink.apple.com
  16.                      AppleLink:    APPLE.BUGS
  17.  
  18. */
  19.  
  20. #ifndef __DESKBUS__
  21. #define __DESKBUS__
  22.  
  23.  
  24. #ifndef __TYPES__
  25. #include <Types.h>
  26. #endif
  27. /*    #include <ConditionalMacros.h>                                */
  28.  
  29. #ifndef __MIXEDMODE__
  30. #include <MixedMode.h>
  31. #endif
  32.  
  33. #ifdef __cplusplus
  34. extern "C" {
  35. #endif
  36.  
  37. #if PRAGMA_ALIGN_SUPPORTED
  38. #pragma options align=mac68k
  39. #endif
  40.  
  41. #if PRAGMA_IMPORT_SUPPORTED
  42. #pragma import on
  43. #endif
  44.  
  45. typedef char ADBAddress;
  46.  
  47. /*
  48.         ADBCompletionProcPtr uses register based parameters on the 68k and cannot
  49.         be written in or called from a high-level language without the help of
  50.         mixed mode or assembly glue.
  51.  
  52.             typedef pascal void (*ADBCompletionProcPtr)(Ptr dataBuffPtr, Ptr opDataAreaPtr, long command);
  53.  
  54.         In:
  55.          => dataBuffPtr     A0.L
  56.          => opDataAreaPtr    A2.L
  57.          => command         D0.L
  58. */
  59.  
  60. #if GENERATINGCFM
  61. typedef UniversalProcPtr ADBCompletionUPP;
  62. #else
  63. typedef Register68kProcPtr ADBCompletionUPP;
  64. #endif
  65.  
  66. enum {
  67.     uppADBCompletionProcInfo = kRegisterBased
  68.          | REGISTER_ROUTINE_PARAMETER(1, kRegisterA0, SIZE_CODE(sizeof(Ptr)))
  69.          | REGISTER_ROUTINE_PARAMETER(2, kRegisterA2, SIZE_CODE(sizeof(Ptr)))
  70.          | REGISTER_ROUTINE_PARAMETER(3, kRegisterD0, SIZE_CODE(sizeof(long)))
  71. };
  72.  
  73. #if GENERATINGCFM
  74. #define NewADBCompletionProc(userRoutine)        \
  75.         (ADBCompletionUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppADBCompletionProcInfo, GetCurrentArchitecture())
  76. #else
  77. #define NewADBCompletionProc(userRoutine)        \
  78.         ((ADBCompletionUPP) (userRoutine))
  79. #endif
  80.  
  81. #if GENERATINGCFM
  82. #define CallADBCompletionProc(userRoutine, dataBuffPtr, opDataAreaPtr, command)        \
  83.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppADBCompletionProcInfo, (dataBuffPtr), (opDataAreaPtr), (command))
  84. #else
  85. /* (*ADBCompletionProcPtr) cannot be called from a high-level language without the Mixed Mode Manager */
  86. #endif
  87.  
  88. /*
  89.         ADBDeviceDriverProcPtr uses register based parameters on the 68k and cannot
  90.         be written in or called from a high-level language without the help of
  91.         mixed mode or assembly glue.
  92.  
  93.             typedef pascal void (*ADBDeviceDriverProcPtr)(char devAddress, char devType);
  94.  
  95.         In:
  96.          => devAddress      D0.B
  97.          => devType         D1.B
  98. */
  99.  
  100. #if GENERATINGCFM
  101. typedef UniversalProcPtr ADBDeviceDriverUPP;
  102. #else
  103. typedef Register68kProcPtr ADBDeviceDriverUPP;
  104. #endif
  105.  
  106. enum {
  107.     uppADBDeviceDriverProcInfo = kRegisterBased
  108.          | REGISTER_ROUTINE_PARAMETER(1, kRegisterD0, SIZE_CODE(sizeof(char)))
  109.          | REGISTER_ROUTINE_PARAMETER(2, kRegisterD1, SIZE_CODE(sizeof(char)))
  110. };
  111.  
  112. #if GENERATINGCFM
  113. #define NewADBDeviceDriverProc(userRoutine)        \
  114.         (ADBDeviceDriverUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppADBDeviceDriverProcInfo, GetCurrentArchitecture())
  115. #else
  116. #define NewADBDeviceDriverProc(userRoutine)        \
  117.         ((ADBDeviceDriverUPP) (userRoutine))
  118. #endif
  119.  
  120. #if GENERATINGCFM
  121. #define CallADBDeviceDriverProc(userRoutine, devAddress, devType)        \
  122.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppADBDeviceDriverProcInfo, (devAddress), (devType))
  123. #else
  124. /* (*ADBDeviceDriverProcPtr) cannot be called from a high-level language without the Mixed Mode Manager */
  125. #endif
  126.  
  127. /*
  128.         ADBServiceRoutineProcPtr uses register based parameters on the 68k and cannot
  129.         be written in or called from a high-level language without the help of
  130.         mixed mode or assembly glue.
  131.  
  132.             typedef pascal void (*ADBServiceRoutineProcPtr)(Ptr dataBuffPtr, ADBCompletionUPP completionProc, Ptr dataPtr, long command);
  133.  
  134.         In:
  135.          => dataBuffPtr     A0.L
  136.          => completionProc    A1.L
  137.          => dataPtr         A2.L
  138.          => command         D0.L
  139. */
  140.  
  141. #if GENERATINGCFM
  142. typedef UniversalProcPtr ADBServiceRoutineUPP;
  143. #else
  144. typedef Register68kProcPtr ADBServiceRoutineUPP;
  145. #endif
  146.  
  147. enum {
  148.     uppADBServiceRoutineProcInfo = kRegisterBased
  149.          | REGISTER_ROUTINE_PARAMETER(1, kRegisterA0, SIZE_CODE(sizeof(Ptr)))
  150.          | REGISTER_ROUTINE_PARAMETER(2, kRegisterA1, SIZE_CODE(sizeof(ADBCompletionUPP)))
  151.          | REGISTER_ROUTINE_PARAMETER(3, kRegisterA2, SIZE_CODE(sizeof(Ptr)))
  152.          | REGISTER_ROUTINE_PARAMETER(4, kRegisterD0, SIZE_CODE(sizeof(long)))
  153. };
  154.  
  155. #if GENERATINGCFM
  156. #define NewADBServiceRoutineProc(userRoutine)        \
  157.         (ADBServiceRoutineUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppADBServiceRoutineProcInfo, GetCurrentArchitecture())
  158. #else
  159. #define NewADBServiceRoutineProc(userRoutine)        \
  160.         ((ADBServiceRoutineUPP) (userRoutine))
  161. #endif
  162.  
  163. #if GENERATINGCFM
  164. #define CallADBServiceRoutineProc(userRoutine, dataBuffPtr, completionProc, dataPtr, command)        \
  165.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppADBServiceRoutineProcInfo, (dataBuffPtr), (completionProc), (dataPtr), (command))
  166. #else
  167. /* (*ADBServiceRoutineProcPtr) cannot be called from a high-level language without the Mixed Mode Manager */
  168. #endif
  169.  
  170. /*
  171.         ADBInitProcPtr uses register based parameters on the 68k and cannot
  172.         be written in or called from a high-level language without the help of
  173.         mixed mode or assembly glue.
  174.  
  175.             typedef pascal void (*ADBInitProcPtr)(char callOrder);
  176.  
  177.         In:
  178.          => callOrder       D0.B
  179. */
  180.  
  181. #if GENERATINGCFM
  182. typedef UniversalProcPtr ADBInitUPP;
  183. #else
  184. typedef Register68kProcPtr ADBInitUPP;
  185. #endif
  186.  
  187. enum {
  188.     uppADBInitProcInfo = kRegisterBased
  189.          | REGISTER_ROUTINE_PARAMETER(1, kRegisterD0, SIZE_CODE(sizeof(char)))
  190. };
  191.  
  192. #if GENERATINGCFM
  193. #define NewADBInitProc(userRoutine)        \
  194.         (ADBInitUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppADBInitProcInfo, GetCurrentArchitecture())
  195. #else
  196. #define NewADBInitProc(userRoutine)        \
  197.         ((ADBInitUPP) (userRoutine))
  198. #endif
  199.  
  200. #if GENERATINGCFM
  201. #define CallADBInitProc(userRoutine, callOrder)        \
  202.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppADBInitProcInfo, (callOrder))
  203. #else
  204. /* (*ADBInitProcPtr) cannot be called from a high-level language without the Mixed Mode Manager */
  205. #endif
  206.  
  207. struct ADBOpBlock {
  208.     Ptr                                dataBuffPtr;                /* address of data buffer */
  209.     ADBServiceRoutineUPP            opServiceRtPtr;                /* service routine pointer */
  210.     Ptr                                opDataAreaPtr;                /* optional data area address */
  211. };
  212. typedef struct ADBOpBlock ADBOpBlock;
  213.  
  214. typedef ADBOpBlock *ADBOpBPtr;
  215.  
  216. struct ADBDataBlock {
  217.     char                            devType;                    /* device type */
  218.     char                            origADBAddr;                /* original ADB Address */
  219.     ADBServiceRoutineUPP            dbServiceRtPtr;                /* service routine pointer */
  220.     Ptr                                dbDataAreaAddr;                /* data area address */
  221. };
  222. typedef struct ADBDataBlock ADBDataBlock;
  223.  
  224. typedef ADBDataBlock *ADBDBlkPtr;
  225.  
  226. struct ADBSetInfoBlock {
  227.     ADBServiceRoutineUPP            siService;                    /* service routine pointer */
  228.     Ptr                                siDataAreaAddr;                /* data area address */
  229. };
  230. typedef struct ADBSetInfoBlock ADBSetInfoBlock;
  231.  
  232. typedef ADBSetInfoBlock *ADBSInfoPtr;
  233.  
  234. extern pascal void ADBReInit(void)
  235.  ONEWORDINLINE(0xA07B);
  236. extern pascal OSErr ADBOp(Ptr data, ADBCompletionUPP compRout, Ptr buffer, short commandNum);
  237.  
  238. #if !GENERATINGCFM
  239. #pragma parameter __D0 CountADBs
  240. #endif
  241. extern pascal short CountADBs(void)
  242.  ONEWORDINLINE(0xA077);
  243.  
  244. #if !GENERATINGCFM
  245. #pragma parameter __D0 GetIndADB(__A0, __D0)
  246. #endif
  247. extern pascal ADBAddress GetIndADB(ADBDataBlock *info, short devTableIndex)
  248.  ONEWORDINLINE(0xA078);
  249.  
  250. #if !GENERATINGCFM
  251. #pragma parameter __D0 GetADBInfo(__A0, __D0)
  252. #endif
  253. extern pascal OSErr GetADBInfo(ADBDataBlock *info, ADBAddress adbAddr)
  254.  ONEWORDINLINE(0xA079);
  255.  
  256. #if !GENERATINGCFM
  257. #pragma parameter __D0 SetADBInfo(__A0, __D0)
  258. #endif
  259. extern pascal OSErr SetADBInfo(const ADBSetInfoBlock *info, ADBAddress adbAddr)
  260.  ONEWORDINLINE(0xA07A);
  261.  
  262. #if PRAGMA_IMPORT_SUPPORTED
  263. #pragma import off
  264. #endif
  265.  
  266. #if PRAGMA_ALIGN_SUPPORTED
  267. #pragma options align=reset
  268. #endif
  269.  
  270. #ifdef __cplusplus
  271. }
  272. #endif
  273.  
  274. #endif /* __DESKBUS__ */
  275.